// whether we want to expose this object or not
// (expose on backend for testing and previewing purposes, hide in production mode)
// if true, this would say `window.EasyUpsell = `
(function(global) {
//////////////////////////////////////////////////////////////////////////////
// CONSTANTS & VARIABLES
// all text surrounded with "__" are injected from the backend
// when this script is built
//////////////////////////////////////////////////////////////////////////////
if(performance && performance.timing && performance.timing.connectStart) {
// this was added with post-checkout upsells
// before this point, fTimeTaken was using FRAMEWORK_START
var PAGE_LOADED = performance.timing.connectStart / 1000;
} else {
var PAGE_LOADED = Date.now() / 1000;
}
var TEST_SCRIPT = 0;
if(TEST_SCRIPT) {
var devLog = function(text, obj) {
if(obj) {
console.log('EU: '+text, obj);
} else {
console.log('EU: '+text);
}
};
} else {
var devLog = function() {};
}
/** url of this store. used to determine if the script was loaded from the store or from the easy upsell website */
var STORE_URL = ('asa2fly.com').replace(/www\./, '').replace(/us\./, '');
/** Unique ID of the upsell popup - from backend */
var UNIQUE_ID = 'eudcc4cf4a450d83f40338';
/** Unique ID with hashtag for html ids */
var HASHED_ID = '#' + UNIQUE_ID;
/** Store ID that created this script */
var STORE_ID = 1481;
/** url of the app for backend api calls */
var APP_URL = '//app.easyupsellapp.com';
var API_URL = APP_URL+'/api';
/** various html variables for building upsell - injected, can be different per store */
var UPSELL_CONTAINER = '
';
var CHOOSE_OPTIONS_TEXT = 'Choose Options';
var ADDED_TEXT = 'Added to Cart!';
var ORDER_NOW_TEXT = 'Order Now';
var ADD_MANUALLY_TEXT = 'Please add manually';
var OPTIONS_ADD_MANUALLY_ERROR_TEXT = 'Error. Please add manually through product page.';
var OPTIONS_INVALID_ERROR_TEXT = 'Error. Please check over the options and try again.';
var OPTION_REQUIRED_TEXT = 'Option required.';
var OPTION_COMBINATION_UNAVAILABLE_TEXT = 'The selected product combination is currently unavailable.';
var OPTION_COMBINATION_OUT_OF_STOCK = 'The selected product combination is out of stock.';
/** used for formatting prices */
var CURRENCY_SYMBOL = '$';
var DECIMAL_SEPARATOR = '.';
var THOUSANDS_SEPARATOR = ',';
var CURRENCY_SYMBOL_LOCATION = 'left';
var DECIMAL_PLACES = 2;
var SHOW_LOADING_SCREEN = 1;
var FREESHIPPING_AMOUNT = 0;
/** route for requesting things from the storefront api (cart, add to cart, etc) */
var STOREFRONT_API_URL = '/api/storefront';
/** url to get the css for this store */
var CSS_URL = 'https://app.easyupsellapp.com/data/upsellassets/1481/598d9dc657f6ab93695c.css';
/** raw css to be injected into the head */
var CSS_STRING = '#eudcc4cf4a450d83f40338 *,#eudcc4cf4a450d83f40338 *::before,#eudcc4cf4a450d83f40338 *::after{box-sizing:border-box}#eudcc4cf4a450d83f40338 html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0)}#eudcc4cf4a450d83f40338 article,#eudcc4cf4a450d83f40338 aside,#eudcc4cf4a450d83f40338 figcaption,#eudcc4cf4a450d83f40338 figure,#eudcc4cf4a450d83f40338 footer,#eudcc4cf4a450d83f40338 header,#eudcc4cf4a450d83f40338 hgroup,#eudcc4cf4a450d83f40338 main,#eudcc4cf4a450d83f40338 nav,#eudcc4cf4a450d83f40338 section{display:block}#eudcc4cf4a450d83f40338 body{margin:0;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",\"Liberation Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}#eudcc4cf4a450d83f40338 [tabindex=\"-1\"]:focus:not(:focus-visible){outline:0!important}#eudcc4cf4a450d83f40338 hr{box-sizing:content-box;height:0;overflow:visible}#eudcc4cf4a450d83f40338 h1,#eudcc4cf4a450d83f40338 h2,#eudcc4cf4a450d83f40338 h3,#eudcc4cf4a450d83f40338 h4,#eudcc4cf4a450d83f40338 h5,#eudcc4cf4a450d83f40338 h6{margin-top:0;margin-bottom:.5rem}#eudcc4cf4a450d83f40338 p{margin-top:0;margin-bottom:1rem}#eudcc4cf4a450d83f40338 abbr[title],#eudcc4cf4a450d83f40338 abbr[data-original-title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}#eudcc4cf4a450d83f40338 address{margin-bottom:1rem;font-style:normal;line-height:inherit}#eudcc4cf4a450d83f40338 ol,#eudcc4cf4a450d83f40338 ul,#eudcc4cf4a450d83f40338 dl{margin-top:0;margin-bottom:1rem}#eudcc4cf4a450d83f40338 ol ol,#eudcc4cf4a450d83f40338 ul ul,#eudcc4cf4a450d83f40338 ol ul,#eudcc4cf4a450d83f40338 ul ol{margin-bottom:0}#eudcc4cf4a450d83f40338 dt{font-weight:700}#eudcc4cf4a450d83f40338 dd{margin-bottom:.5rem;margin-left:0}#eudcc4cf4a450d83f40338 blockquote{margin:0 0 1rem}#eudcc4cf4a450d83f40338 b,#eudcc4cf4a450d83f40338 strong{font-weight:bolder}#eudcc4cf4a450d83f40338 small{font-size:80%}#eudcc4cf4a450d83f40338 sub,#eudcc4cf4a450d83f40338 sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}#eudcc4cf4a450d83f40338 sub{bottom:-.25em}#eudcc4cf4a450d83f40338 sup{top:-.5em}#eudcc4cf4a450d83f40338 a{color:#007bff;text-decoration:none;background-color:transparent}#eudcc4cf4a450d83f40338 a:hover{color:#0056b3;text-decoration:underline}#eudcc4cf4a450d83f40338 a:not([href]):not([class]){color:inherit;text-decoration:none}#eudcc4cf4a450d83f40338 a:not([href]):not([class]):hover{color:inherit;text-decoration:none}#eudcc4cf4a450d83f40338 pre,#eudcc4cf4a450d83f40338 code,#eudcc4cf4a450d83f40338 kbd,#eudcc4cf4a450d83f40338 samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;font-size:1em}#eudcc4cf4a450d83f40338 pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}#eudcc4cf4a450d83f40338 figure{margin:0 0 1rem}#eudcc4cf4a450d83f40338 img{vertical-align:middle;border-style:none}#eudcc4cf4a450d83f40338 svg{overflow:hidden;vertical-align:middle}#eudcc4cf4a450d83f40338 table{border-collapse:collapse}#eudcc4cf4a450d83f40338 caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}#eudcc4cf4a450d83f40338 th{text-align:inherit;text-align:-webkit-match-parent}#eudcc4cf4a450d83f40338 label{display:inline-block;margin-bottom:.5rem}#eudcc4cf4a450d83f40338 button{border-radius:0}#eudcc4cf4a450d83f40338 button:focus:not(:focus-visible){outline:0}#eudcc4cf4a450d83f40338 input,#eudcc4cf4a450d83f40338 button,#eudcc4cf4a450d83f40338 select,#eudcc4cf4a450d83f40338 optgroup,#eudcc4cf4a450d83f40338 textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}#eudcc4cf4a450d83f40338 button,#eudcc4cf4a450d83f40338 input{overflow:visible}#eudcc4cf4a450d83f40338 button,#eudcc4cf4a450d83f40338 select{text-transform:none}#eudcc4cf4a450d83f40338 [role=\"button\"]{cursor:pointer}#eudcc4cf4a450d83f40338 select{word-wrap:normal}#eudcc4cf4a450d83f40338 button,#eudcc4cf4a450d83f40338 [type=\"button\"],#eudcc4cf4a450d83f40338 [type=\"reset\"],#eudcc4cf4a450d83f40338 [type=\"submit\"]{-webkit-appearance:button}#eudcc4cf4a450d83f40338 button:not(:disabled),#eudcc4cf4a450d83f40338 [type=\"button\"]:not(:disabled),#eudcc4cf4a450d83f40338 [type=\"reset\"]:not(:disabled),#eudcc4cf4a450d83f40338 [type=\"submit\"]:not(:disabled){cursor:pointer}#eudcc4cf4a450d83f40338 button::-moz-focus-inner,#eudcc4cf4a450d83f40338 [type=\"button\"]::-moz-focus-inner,#eudcc4cf4a450d83f40338 [type=\"reset\"]::-moz-focus-inner,#eudcc4cf4a450d83f40338 [type=\"submit\"]::-moz-focus-inner{padding:0;border-style:none}#eudcc4cf4a450d83f40338 input[type=\"radio\"],#eudcc4cf4a450d83f40338 input[type=\"checkbox\"]{box-sizing:border-box;padding:0}#eudcc4cf4a450d83f40338 textarea{overflow:auto;resize:vertical}#eudcc4cf4a450d83f40338 fieldset{min-width:0;padding:0;margin:0;border:0}#eudcc4cf4a450d83f40338 legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}#eudcc4cf4a450d83f40338 progress{vertical-align:baseline}#eudcc4cf4a450d83f40338 [type=\"number\"]::-webkit-inner-spin-button,#eudcc4cf4a450d83f40338 [type=\"number\"]::-webkit-outer-spin-button{height:auto}#eudcc4cf4a450d83f40338 [type=\"search\"]{outline-offset:-2px;-webkit-appearance:none}#eudcc4cf4a450d83f40338 [type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}#eudcc4cf4a450d83f40338 ::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}#eudcc4cf4a450d83f40338 output{display:inline-block}#eudcc4cf4a450d83f40338 summary{display:list-item;cursor:pointer}#eudcc4cf4a450d83f40338 template{display:none}#eudcc4cf4a450d83f40338 [hidden]{display:none!important}#eudcc4cf4a450d83f40338 *{font-family:\"Open Sans\"}#eudcc4cf4a450d83f40338 .popup-backdrop{position:absolute;overflow-y:auto;background-color:rgba(0,0,0,.5);align-items:center;z-index:1000000000;display:flex;align-items:center;justify-content:center;top:0;right:0;bottom:0;left:0;padding:.625em;overflow-x:hidden}#eudcc4cf4a450d83f40338 .popup-backdrop.full-size{position:fixed}#eudcc4cf4a450d83f40338 .popup{max-width:700px;width:95%;margin:auto;background-color:#fff;border-radius:.5rem;border:0 solid #fff;display:flex;flex-direction:column;align-items:center;overflow:hidden}#eudcc4cf4a450d83f40338 .popup .loading-container{padding:1.25em;text-align:center}#eudcc4cf4a450d83f40338 .popup .upsell-content{display:flex;flex-direction:column;position:relative;width:100%;padding:1rem 2rem 0rem 2rem}#eudcc4cf4a450d83f40338 .popup .upsell-content .headline-section{padding:.5rem 1.25rem;background-color:#fff}#eudcc4cf4a450d83f40338 .popup .upsell-content .product-section{padding:0 1.25rem 0 1.25rem;background-color:#fff}#eudcc4cf4a450d83f40338 .popup .upsell-content .free-shipping-section{display:none}#eudcc4cf4a450d83f40338 .popup .upsell-content .free-shipping-title{text-align:center;font-weight:700;padding:0 1rem}#eudcc4cf4a450d83f40338 .popup .upsell-content .free-shipping-bar{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center}#eudcc4cf4a450d83f40338 .popup .upsell-content .free-shipping-bg{width:100%;background-color:#f0f0f0;height:8px;border-radius:8px;margin:10px -5px 10px 0}#eudcc4cf4a450d83f40338 .popup .upsell-content .free-shipping-progress{background-color:#c90076;height:8px;border-radius:8px;width:0%;transition:all 0.5s ease}#eudcc4cf4a450d83f40338 .popup .upsell-content .free-shipping-label{width:100px;font-size:.7em;font-weight:700;border-radius:10px;background-color:#fff;color:#555;text-align:center;padding:2px 0;box-shadow:0 3px 3px 0 #ccc;z-index:1}#eudcc4cf4a450d83f40338 .popup-close-icon{position:absolute;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color 0.1s ease-out;border:none;border-radius:0;outline:initial;background:transparent;color:#fff;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}#eudcc4cf4a450d83f40338 .popup-close-icon:hover{transform:none;background:transparent;color:#f27474}#eudcc4cf4a450d83f40338 .product-image-container{background-color:#fff;text-align:center}#eudcc4cf4a450d83f40338 .loading-button{padding-left:30px;padding-right:50px}@-webkit-keyframes easyupsell-popup-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes easyupsell-popup-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes easyupsell-popup-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes easyupsell-popup-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}#eudcc4cf4a450d83f40338 .popup-show{-webkit-animation:easyupsell-popup-show 0.3s;animation:easyupsell-popup-show 0.3s}#eudcc4cf4a450d83f40338 .popup-hide{-webkit-animation:easyupsell-popup-hide 0.15s forwards;animation:easyupsell-popup-hide 0.15s forwards}#eudcc4cf4a450d83f40338 ::-webkit-scrollbar{-webkit-appearance:none;width:7px}#eudcc4cf4a450d83f40338 ::-webkit-scrollbar-thumb{border-radius:4px;background-color:rgba(0,0,0,.5);box-shadow:0 0 1px rgba(255,255,255,.5)}#eudcc4cf4a450d83f40338 a{text-decoration:none}#eudcc4cf4a450d83f40338 a:hover{text-decoration:none}#eudcc4cf4a450d83f40338 table,#eudcc4cf4a450d83f40338 tr,#eudcc4cf4a450d83f40338 td{padding:0;margin:0;border:none}#eudcc4cf4a450d83f40338 table,#eudcc4cf4a450d83f40338 tbody,#eudcc4cf4a450d83f40338 tr:nth-child(odd){background:#fff}#eudcc4cf4a450d83f40338 table,#eudcc4cf4a450d83f40338 tbody,#eudcc4cf4a450d83f40338 tr:nth-child(even){background:#f7f7f7}#eudcc4cf4a450d83f40338 table td{align-items:center;vertical-align:middle;padding:0 2px 0 2px}#eudcc4cf4a450d83f40338 .product-list-container{display:flex;flex-wrap:wrap;flex-grow:1}#eudcc4cf4a450d83f40338 .choose-options-container{display:flex;flex-direction:column;align-items:center;justify-content:space-around;text-align:left;margin-top:10px}#eudcc4cf4a450d83f40338 .choose-options-container .product-options-row{display:flex;align-items:center;width:100%}#eudcc4cf4a450d83f40338 .choose-options-container .product-image{width:100%;height:300px;max-height:unset}#eudcc4cf4a450d83f40338 .choose-options-container .product-information{text-align:center;margin-bottom:15px}#eudcc4cf4a450d83f40338 .choose-options-container .product-information .product-link .product-name{margin-left:0!important}#eudcc4cf4a450d83f40338 .choose-options-container .product-options-container{flex-grow:1;margin-left:3%;align-self:flex-start}#eudcc4cf4a450d83f40338 .choose-options-container .divider-row td{padding:5px}#eudcc4cf4a450d83f40338 .choose-options-container .option-error-row .option-error{text-align:right}#eudcc4cf4a450d83f40338 .choose-options-container .option-label{text-align:left;padding-right:10px}#eudcc4cf4a450d83f40338 .choose-options-container .product-price{text-align:left}#eudcc4cf4a450d83f40338 .choose-options-container .error-message,#eudcc4cf4a450d83f40338 .choose-options-container .option-error{color:#b81818}#eudcc4cf4a450d83f40338 .choose-options-container .error-message{text-align:right}#eudcc4cf4a450d83f40338 .choose-options-container select,#eudcc4cf4a450d83f40338 .choose-options-container input[type=text],#eudcc4cf4a450d83f40338 .choose-options-container input[type=number],#eudcc4cf4a450d83f40338 .choose-options-container input[type=date],#eudcc4cf4a450d83f40338 .choose-options-container textarea{padding:10px;border-radius:5px;border:1px inset #000}#eudcc4cf4a450d83f40338 .choose-options-container .options-list{margin-left:0}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .strikeout-price{margin-left:0}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .quantity-input{padding:10px 0}#eudcc4cf4a450d83f40338 .choose-options-container .options-list table{width:100%;background:#fff}#eudcc4cf4a450d83f40338 .choose-options-container .options-list table,#eudcc4cf4a450d83f40338 .choose-options-container .options-list tbody,#eudcc4cf4a450d83f40338 .choose-options-container .options-list tr:nth-child(odd){background:#fff}#eudcc4cf4a450d83f40338 .choose-options-container .options-list table,#eudcc4cf4a450d83f40338 .choose-options-container .options-list tbody,#eudcc4cf4a450d83f40338 .choose-options-container .options-list tr:nth-child(even){background:#fff}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option select,#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option input[type=text],#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option input[type=number],#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option input[type=date],#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option textarea{width:100%}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option .option-values{display:flex;align-items:center;justify-content:start}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option .option-value{text-align:left}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=checkbox] .option-value label{display:flex;align-items:center}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=checkbox] .option-value label input{margin-right:5px}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .options-height{height:80px}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .option-values{display:inline-block}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .option-values .option-value:has(img){height:100%}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .option-values .option-value{display:inline-flex;border:2px solid gray;margin-right:2px;cursor:pointer}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .option-values .option-value.selected{border:2px solid red}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .option-values .option-value div.option-pattern{height:30px;width:30px}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=patternSelect] .option-values .option-value img.option-pattern{height:100%;width:100%}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=productSelect] .option-values{padding:5px;max-height:175px;overflow:auto;border:1px solid #ddd;border-radius:5px;display:block}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=productSelect] .option-values .option-value{cursor:pointer}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=productSelect] .option-values .option-value label{cursor:pointer;display:flex;align-items:center}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=productSelect] .option-values .option-value label input{cursor:pointer;margin-right:5px}#eudcc4cf4a450d83f40338 .choose-options-container .options-list .option[data-option-type=productSelect] .option-values .option-value label .product-select-image{cursor:pointer;width:50px;max-height:50px;margin-right:10px}#eudcc4cf4a450d83f40338 .choose-options-container .options-actions{display:flex;justify-content:flex-end;align-items:center}#eudcc4cf4a450d83f40338 .choose-options-container .options-actions .choose-options-cancel{margin-right:10px}#eudcc4cf4a450d83f40338 .price-separator{margin:0 5px}#eudcc4cf4a450d83f40338 .strikeout-price{text-decoration:line-through}#eudcc4cf4a450d83f40338 .sale-price{font-weight:700}#eudcc4cf4a450d83f40338 .headline{text-align:center;color:#000;margin-top:.5rem;margin-bottom:.5rem;font-size:16px;font-family:\"Open Sans\";font-style:normal;font-weight:400;line-height:1}#eudcc4cf4a450d83f40338 .description{text-align:center;font-family:\"Open Sans\";font-size:10px;font-style:normal;font-weight:400;color:#000;line-height:1.5;padding-bottom:.5rem}#eudcc4cf4a450d83f40338 .product-link .product-name{color:#000;font-family:\"Open Sans\";font-size:13px;font-style:normal;font-weight:700;word-break:break-word;margin-left:1rem}#eudcc4cf4a450d83f40338 .product-name .product-name:hover{color:#000}#eudcc4cf4a450d83f40338 .col-12{text-align:center;text-transform:uppercase}#eudcc4cf4a450d83f40338 .col-12:has(>a.no-thanks){margin-top:0}#eudcc4cf4a450d83f40338 .no-thanks,#eudcc4cf4a450d83f40338 .choose-options-cancel{font-family:Open Sans;font-size:13px;font-style:normal;font-weight:700;color:#2986cc}#eudcc4cf4a450d83f40338 .no-thanks,#eudcc4cf4a450d83f40338 .continue-shopping,#eudcc4cf4a450d83f40338 .choose-options-cancel{padding:15px 0;display:block}#eudcc4cf4a450d83f40338 .no-thanks:focus,#eudcc4cf4a450d83f40338 .choose-options-cancel:focus,#eudcc4cf4a450d83f40338 .continue-shopping:focus{outline:none!important}#eudcc4cf4a450d83f40338 .quantity-container{text-align:center}#eudcc4cf4a450d83f40338 .price-label,#eudcc4cf4a450d83f40338 .quantity-label{text-align:center;font-family:Open Sans;font-size:13px;font-style:normal;font-weight:400;color:#000}@keyframes easyupsell-spin{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}#eudcc4cf4a450d83f40338 .eu-loading-icon{display:inline-block;width:45px;height:45px;border-radius:100%;border-top:.3rem solid transparent;border-right:.3rem solid #6464b6;border-bottom:.3rem solid transparent;border-left:.3rem solid #6464b6;animation:easyupsell-spin 1s linear infinite}#eudcc4cf4a450d83f40338 .eu-small-loading-icon{display:inline-block;width:18px;height:18px;border-radius:100%;border-top:.3rem solid transparent;border-right:.3rem solid #fff;border-bottom:.3rem solid transparent;border-left:.3rem solid #fff;animation:easyupsell-spin 1s linear infinite}#eudcc4cf4a450d83f40338 .button-icon-container{display:flex;justify-content:center;align-items:center;padding:0 20px 0 20px}#eudcc4cf4a450d83f40338 .quantity-label{display:inline}#eudcc4cf4a450d83f40338 .quantity-input{width:43.7px;border:1px solid #ddddd1;border-radius:5px 0 0 5px;outline:none;height:100%;background-color:#e9e9ed;font-weight:700;text-align:center}#eudcc4cf4a450d83f40338 .quantity-input:focus{outline:none!important}#eudcc4cf4a450d83f40338 input[type=number]::-webkit-inner-spin-button,#eudcc4cf4a450d83f40338 input[type=number]::-webkit-outer-spin-button{opacity:1}#eudcc4cf4a450d83f40338 .eu-button{text-decoration:none;padding:.5rem .5rem .5rem .5rem;color:#2986cc;border-radius:5px;font-family:Open Sans;font-size:10px;font-weight:700;font-style:normal;display:block;text-align:center;min-width:0;margin:0}#eudcc4cf4a450d83f40338 .eu-button:focus{outline:none!important}#eudcc4cf4a450d83f40338 .add-to-cart,#eudcc4cf4a450d83f40338 .choose-options-button,#eudcc4cf4a450d83f40338 .choose-options-add-to-cart,#eudcc4cf4a450d83f40338 .go-to-product-page-button{background-color:#eee;text-transform:uppercase;border-radius:10px}#eudcc4cf4a450d83f40338 .add-to-cart:hover,#eudcc4cf4a450d83f40338 .choose-options-button:hover,#eudcc4cf4a450d83f40338 .choose-options-add-to-cart:hover,#eudcc4cf4a450d83f40338 .go-to-product-page-button:hover{background-color:#dcdcdc}#eudcc4cf4a450d83f40338 .choose-options-add-to-cart{border-radius:5px;margin-top:30px}#eudcc4cf4a450d83f40338 .quantity-container,#eudcc4cf4a450d83f40338 a.choose-options-button{border-radius:5px 5px 5px 5px}#eudcc4cf4a450d83f40338 .go-to-product-page-button{margin-top:10px}#eudcc4cf4a450d83f40338 .checkout-button,#eudcc4cf4a450d83f40338 .order-now-button{margin-top:15px;margin-bottom:0;padding:15px;background-color:#cfe2f3;font-size:13px}#eudcc4cf4a450d83f40338 .checkout-button:hover,#eudcc4cf4a450d83f40338 .order-now-button:hover{background-color:#b2d1ec}#eudcc4cf4a450d83f40338 .eu-button:hover{color:#fff;text-decoration:none}#eudcc4cf4a450d83f40338 .disabled-button{background-color:#9e9e9e}#eudcc4cf4a450d83f40338 .disabled-button:hover{background-color:#9e9e9e}#eudcc4cf4a450d83f40338 .actions-container{border-top:0 solid #ddd;padding-top:0;margin-top:10px;display:flex;align-items:center;flex-wrap:wrap;margin-left:0;margin-right:0}#eudcc4cf4a450d83f40338 .custom-border-add-to-cart{border-radius:0 5px 5px 0}#eudcc4cf4a450d83f40338 .count-down p{text-align:center;margin:0}#eudcc4cf4a450d83f40338 .count-down table tr td{text-align:center}#eudcc4cf4a450d83f40338 .count-down table th{padding-top:.15rem;padding-bottom:.15rem;border:none;text-align:center}#eudcc4cf4a450d83f40338 .count-down table th span{color:#cd2700;font-size:18px}#eudcc4cf4a450d83f40338 .count-down table td span{font-size:14px}#eudcc4cf4a450d83f40338 .cart-container .btn-group{position:relative;display:inline-flex;vertical-align:middle}#eudcc4cf4a450d83f40338 .d-none{display:none}#eudcc4cf4a450d83f40338 .order-2{order:2}#eudcc4cf4a450d83f40338 .actions-container .col-actions .row{display:flex;flex-wrap:wrap}#eudcc4cf4a450d83f40338 .actions-container .col-actions .row .col-12{flex:0 0 100%;max-width:100%;padding:0}#eudcc4cf4a450d83f40338 .cart-container{text-align:center;display:table-cell}#eudcc4cf4a450d83f40338 .product-separator{width:100%;clear:both}#eudcc4cf4a450d83f40338 .product-image{max-width:100%;max-height:200px;width:auto}#eudcc4cf4a450d83f40338 .product-container{margin:0}@media only screen and (min-width:501px){#eudcc4cf4a450d83f40338{}}#eudcc4cf4a450d83f40338.list-style-single .product-name{overflow:hidden;width:100%;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}#eudcc4cf4a450d83f40338.list-style-single .actions-container{margin:0}#eudcc4cf4a450d83f40338.list-style-single .count-down{text-align:center;padding:0 10%}#eudcc4cf4a450d83f40338.list-style-single .product-container{display:flex;width:100%;align-items:center}#eudcc4cf4a450d83f40338.list-style-single .product-container .price-label{margin:-25px 0}#eudcc4cf4a450d83f40338.list-style-single .product-container .product-image-container{height:200px;width:45%}#eudcc4cf4a450d83f40338.list-style-single .product-container .product-info-container{width:55%}#eudcc4cf4a450d83f40338.list-style-single .product-container .product-info-container hr{border-top:1.5px solid #fff;margin:2rem 0 1.92857rem}#eudcc4cf4a450d83f40338.list-style-single .product-container .product-link .product-name{text-align:center}#eudcc4cf4a450d83f40338.list-style-single .product-container .product-info-container .btn-group{width:100%;padding-left:10%;margin-top:0;display:flex}#eudcc4cf4a450d83f40338.list-style-single .product-container .add-to-cart{padding:.5rem 1.8rem}#eudcc4cf4a450d83f40338.list-style-single .product-container .custom-border-add-to-cart{margin-right:0}#eudcc4cf4a450d83f40338.list-style-mobile .test-container{width:60%}#eudcc4cf4a450d83f40338.list-style-mobile .product-name-container{width:95%}#eudcc4cf4a450d83f40338.list-style-mobile .product-name{overflow:hidden;width:100%;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}#eudcc4cf4a450d83f40338.list-style-mobile .cart-container{display:table-cell;width:100%}#eudcc4cf4a450d83f40338.list-style-mobile .product-container{margin-bottom:5px}#eudcc4cf4a450d83f40338.list-style-mobile tr:nth-child(odd){background:transparent}#eudcc4cf4a450d83f40338.list-style-mobile .row-options{display:flex;justify-content:space-between;align-items:center}#eudcc4cf4a450d83f40338.list-style-mobile .price-label{text-align:start}#eudcc4cf4a450d83f40338.list-style-mobile .quantity-container:empty{display:none}#eudcc4cf4a450d83f40338.list-style-mobile .btn-group{width:100%}#eudcc4cf4a450d83f40338.list-style-mobile .button-container{width:100%}#eudcc4cf4a450d83f40338.list-style-mobile .product-container tr:nth-child(odd){background:none!important}#eudcc4cf4a450d83f40338.list-style-mobile .quantity-container:empty{display:none}#eudcc4cf4a450d83f40338.list-style-mobile .count-down{margin:20px 40px -5px 40px}#eudcc4cf4a450d83f40338.list-style-mobile .product-information{margin:15px 0 15px 0;text-align:center}#eudcc4cf4a450d83f40338.list-style-mobile .choose-options-container{flex-direction:column;align-items:stretch}#eudcc4cf4a450d83f40338.list-style-mobile .popup{max-width:500px}#eudcc4cf4a450d83f40338.list-style-mobile .upsell-content{padding:.5rem 1rem}#eudcc4cf4a450d83f40338.list-style-mobile .upsell-content .product-section{padding:0;background-color:#fff}#eudcc4cf4a450d83f40338.list-style-mobile .swal2-popup{padding:.5rem}#eudcc4cf4a450d83f40338.list-style-mobile .options-actions .eu-button{font-size:1rem}#eudcc4cf4a450d83f40338.list-style-mobile .choose-options-add-to-cart{margin-top:10px}#eudcc4cf4a450d83f40338.list-style-mobile .eu-button{font-size:10px}#eudcc4cf4a450d83f40338.list-style-mobile .no-thanks,#eudcc4cf4a450d83f40338.list-style-mobile .continue-shopping,#eudcc4cf4a450d83f40338.list-style-mobile .choose-options-cancel{padding:10px 0}#eudcc4cf4a450d83f40338.list-style-mobile .checkout-button,#eudcc4cf4a450d83f40338.list-style-mobile .order-now-button{font-size:1rem;margin-top:0;margin-bottom:15px;padding:10px}#eudcc4cf4a450d83f40338.list-style-mobile .custom-border-add-to-cart{margin-right:0}#eudcc4cf4a450d83f40338.list-style-mobile .headline{font-size:1.4rem}#eudcc4cf4a450d83f40338.list-style-mobile .actions-container{margin:0;display:block}#eudcc4cf4a450d83f40338.list-style-mobile .col-actions .checkout-button,#eudcc4cf4a450d83f40338.list-style-mobile .col-actions .order-now-button{font-size:14px;margin-top:0;margin-bottom:0}#eudcc4cf4a450d83f40338.list-style-mobile .product-mobile-list-container{background:#fff;width:100%}#eudcc4cf4a450d83f40338.list-style-mobile:not(:last-child){border-bottom:0 solid #e6e6e6}#eudcc4cf4a450d83f40338.list-style-mobile .product-info-container{flex-grow:1;padding-left:5px}#eudcc4cf4a450d83f40338.list-style-mobile .product-image-container{padding:2px}#eudcc4cf4a450d83f40338.list-style-mobile .product-image{max-width:75px;max-height:75px}#eudcc4cf4a450d83f40338.list-style-mobile .product-link{text-align:center}#eudcc4cf4a450d83f40338.list-style-mobile .product-name{font-size:12px;text-align:left;margin-left:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;min-height:36px}#eudcc4cf4a450d83f40338.list-style-mobile .link-and-price{display:flex;justify-content:space-between}#eudcc4cf4a450d83f40338.list-style-mobile .link-and-price .product-link{flex-grow:6;text-align:left}#eudcc4cf4a450d83f40338.list-style-mobile .link-and-price .product-link .product-name{hyphens:auto}#eudcc4cf4a450d83f40338.list-style-mobile .actions-container{flex-grow:1;display:flex;justify-content:space-between;align-items:center;margin-top:0}#eudcc4cf4a450d83f40338.list-style-cards .product-name{overflow:hidden;width:100%;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}#eudcc4cf4a450d83f40338.list-style-cards .btn-group{width:100%}#eudcc4cf4a450d83f40338.list-style-cards .button-container{width:100%}#eudcc4cf4a450d83f40338.list-style-cards .count-down{padding:0 15%}#eudcc4cf4a450d83f40338.list-style-cards table,#eudcc4cf4a450d83f40338.list-style-cards tbody,#eudcc4cf4a450d83f40338.list-style-cards tr:nth-child(odd){background:#fff}#eudcc4cf4a450d83f40338.list-style-cards table,#eudcc4cf4a450d83f40338.list-style-cards tbody,#eudcc4cf4a450d83f40338.list-style-cards tr:nth-child(even){background:#fff}#eudcc4cf4a450d83f40338.list-style-cards table{flex-grow:1}#eudcc4cf4a450d83f40338.list-style-cards td{vertical-align:initial}#eudcc4cf4a450d83f40338.list-style-cards .product-list-container td{padding:5px}#eudcc4cf4a450d83f40338.list-style-cards tr:last-child td{border:none}#eudcc4cf4a450d83f40338.list-style-cards .product-container{width:100%}#eudcc4cf4a450d83f40338.list-style-cards .product-link .product-name{text-align:center;margin-left:0}#eudcc4cf4a450d83f40338.list-style-cards .add-to-cart{padding:.5rem 1.2rem}#eudcc4cf4a450d83f40338.list-style-table .test-container{width:60%}#eudcc4cf4a450d83f40338.list-style-table .product-name-container{width:95%}#eudcc4cf4a450d83f40338.list-style-table .product-name{overflow:hidden;width:100%;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}#eudcc4cf4a450d83f40338.list-style-table .product-container{margin-bottom:5px}#eudcc4cf4a450d83f40338.list-style-table tr:nth-child(odd){background:transparent}#eudcc4cf4a450d83f40338.list-style-table .row-options{display:flex;justify-content:space-between;align-items:center}#eudcc4cf4a450d83f40338.list-style-table .price-label{display:flex;text-align:start;margin-left:1rem}#eudcc4cf4a450d83f40338.list-style-table .cart-container{display:table-cell;width:100%}#eudcc4cf4a450d83f40338.list-style-table .btn-group{width:100%}#eudcc4cf4a450d83f40338.list-style-table .button-container{width:100%}#eudcc4cf4a450d83f40338.list-style-table .product-container tr:nth-child(odd){background:none!important}#eudcc4cf4a450d83f40338.list-style-table .quantity-container:empty{display:none}#eudcc4cf4a450d83f40338.list-style-table tr:nth-child(odd){background:none}#eudcc4cf4a450d83f40338.list-style-table .quantity-container:empty{display:none}#eudcc4cf4a450d83f40338.list-style-table .actions-container{margin:0}#eudcc4cf4a450d83f40338.list-style-table .quantity-container,#eudcc4cf4a450d83f40338.list-style-table a.choose-options-button{border-radius:5px 5px 5px 5px}#eudcc4cf4a450d83f40338.list-style-table .custom-border-add-to-cart{margin-right:10px;border-radius:0 5px 5px 0}#eudcc4cf4a450d83f40338.list-style-table .count-down{display:flex;padding:0 160px 0 160px;margin-top:20px;align-items:center;line-height:1rem}#eudcc4cf4a450d83f40338.list-style-table .count-down p{text-align:right;font-size:16px;text-transform:capitalize}#eudcc4cf4a450d83f40338.list-style-table .count-down table tr th span{font-size:24px}#eudcc4cf4a450d83f40338.list-style-table table{flex-grow:1}#eudcc4cf4a450d83f40338.list-style-table table td{padding:2px}#eudcc4cf4a450d83f40338.list-style-table .actions-container{margin-top:0}#eudcc4cf4a450d83f40338.list-style-table .product-container{width:100%}#eudcc4cf4a450d83f40338.list-style-table .product-container:not(:last-child){border-bottom:0 solid #e6e6e6}#eudcc4cf4a450d83f40338.list-style-table .product-container ::-webkit-scrollbar{-webkit-appearance:none;width:7px}#eudcc4cf4a450d83f40338.list-style-table .product-container ::-webkit-scrollbar-thumb{border-radius:4px;background-color:rgba(0,0,0,.5);box-shadow:0 0 1px rgba(255,255,255,.5)}#eudcc4cf4a450d83f40338.list-style-table .product-container .product-container{border-bottom:1px solid #e6e6e6}#eudcc4cf4a450d83f40338.list-style-table .product-container .product-container td{padding:0 0 0 0}#eudcc4cf4a450d83f40338.list-style-table .product-container .product-container:last-child{border:none}#eudcc4cf4a450d83f40338.list-style-table .product-container .product-image-container{padding-top:5px}#eudcc4cf4a450d83f40338.list-style-table .product-container .product-image-container .product-image{max-width:60px;max-height:100px}';
/** url to get font for this store */
var FONT_URL = 'https://fonts.googleapis.com/css2?family=Open+Sans&display=swap';
/** whether to trigger an upsell when a customer clicks an "Add to Cart" button */
var TRIGGER_ON_ADD_TO_CART = 0;
/** whether to trigger an upsell when a customer lands on the checkout page */
var TRIGGER_ON_CHECKOUT = 1;
/** whether to trigger an upsell when a customer lands on the cart page */
var TRIGGER_ON_CART_PAGE = 0;
/** time in ms before a popup will ALWAYS reject. */
var UPSELL_TIMEOUT = 0 ? 15000 : 10000;
/** time in ms before a request to get product options will reject */
var OPTIONS_TIMEOUT = 10000;
/** time in ms before a request to add a product to cart will reject */
var ADD_TO_CART_TIMEOUT = 15000;
/** time after an order that a conversion could still be made for a post-checkout upsell (7 days) */
var POST_CHECKOUT_CONVERSION_TIMEOUT = 86400 * 7;
/** vars to determine what page we're on */
var bStorePage = true;//window.location.href.indexOf(STORE_URL) !== -1;
var bOnCheckoutPage = ['/checkout.php', '/checkout'].indexOf(window.location.pathname) !== -1;
var bOnCartPage = ['/cart.php', '/cart'].indexOf(window.location.pathname) !== -1;
/** if bOnOrderConfirmationPage is true, it means this is a POST-CHECKOUT upsell */
var bOnOrderConfirmationPage = ['/checkout/order-confirmation', '/checkout/order-confirmation.php'].indexOf(window.location.pathname) !== -1;
/** vars to determine what page the user just came from (referrer) */
var referrer = document.referrer.replace(/^[^:]+:\/\/[^/]+/, '').replace(/#.*/, '').replace(/\?.*/, '');
var bFromCartPage = ['/cart.php', '/cart'].indexOf(referrer) !== -1;
var bFromCheckoutPage = ['/checkout', '/checkout.php'].indexOf(referrer) !== -1;
var bFromOrderConfirmationPage = ['/checkout/order-confirmation', '/checkout/order-confirmation.php'].indexOf(referrer) !== -1;
var TRIGGER_LOCATION_PRE_CHECKOUT = 1;
var TRIGGER_LOCATION_POST_CHECKOUT = 2;
var timeToLoad = (Date.now() / 1000) - PAGE_LOADED;
//////////////////////////////////////////////////////////////////////////////
// SETUP AND LOADING ASSETS
//////////////////////////////////////////////////////////////////////////////
/**
* EasyUpsell App variable that contains all public functions and variables.
* if `EXPOSE` is set (for developmental scripts), then this will
* be available as a global as `window.EasyUpsell`
*/
var EasyUpsell = {};
EasyUpsell.currentUpsell = null;
// make sure we haven't loading this script before.
// if we have, just return so no code gets run.
if(window.EASY_UPSELL_SCRIPT_LOADED && window.location.href.indexOf(STORE_URL) !== -1) {
// this script can load multiple times if it's on the easy upsell website
// don't load twice
if(window.EasyUpsell) {
// already loaded, so return that (if we're in EXPOSE mode)
return window.EasyUpsell;
} else {
return null;
}
}
// mark the script as having been loaded if we got to this point.
window.EASY_UPSELL_SCRIPT_LOADED = true;
// prevent js assets from latching on to module.exports (Node.js) and define() (amd / requirejs)
var exports = undefined;
var module = undefined;
var define = undefined;
// setup old global window asset vars so we can use non-conflicting local ones
// var oldMoment = global.moment;
// var oldDateRangePicker = global.daterangepicker;
// include assets (jQuery, Promise polyfill, daterangepicker, etc)
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.ES6Promise = factory());
}(this, (function () { 'use strict';
function objectOrFunction(x) {
var type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
function isFunction(x) {
return typeof x === 'function';
}
var _isArray = void 0;
if (Array.isArray) {
_isArray = Array.isArray;
} else {
_isArray = function (x) {
return Object.prototype.toString.call(x) === '[object Array]';
};
}
var isArray = _isArray;
var len = 0;
var vertxNext = void 0;
var customSchedulerFn = void 0;
var asap = function asap(callback, arg) {
queue[len] = callback;
queue[len + 1] = arg;
len += 2;
if (len === 2) {
// If len is 2, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
if (customSchedulerFn) {
customSchedulerFn(flush);
} else {
scheduleFlush();
}
}
};
function setScheduler(scheduleFn) {
customSchedulerFn = scheduleFn;
}
function setAsap(asapFn) {
asap = asapFn;
}
var browserWindow = typeof window !== 'undefined' ? window : undefined;
var browserGlobal = browserWindow || {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
// test for web worker but not in IE10
var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
// node
function useNextTick() {
// node version 0.10.x displays a deprecation warning when nextTick is used recursively
// see https://github.com/cujojs/when/issues/410 for details
return function () {
return process.nextTick(flush);
};
}
// vertx
function useVertxTimer() {
if (typeof vertxNext !== 'undefined') {
return function () {
vertxNext(flush);
};
}
return useSetTimeout();
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function () {
node.data = iterations = ++iterations % 2;
};
}
// web worker
function useMessageChannel() {
var channel = new MessageChannel();
channel.port1.onmessage = flush;
return function () {
return channel.port2.postMessage(0);
};
}
function useSetTimeout() {
// Store setTimeout reference so es6-promise will be unaffected by
// other code modifying setTimeout (like sinon.useFakeTimers())
var globalSetTimeout = setTimeout;
return function () {
return globalSetTimeout(flush, 1);
};
}
var queue = new Array(1000);
function flush() {
for (var i = 0; i < len; i += 2) {
var callback = queue[i];
var arg = queue[i + 1];
callback(arg);
queue[i] = undefined;
queue[i + 1] = undefined;
}
len = 0;
}
function attemptVertx() {
try {
var vertx = Function('return this')().require('vertx');
vertxNext = vertx.runOnLoop || vertx.runOnContext;
return useVertxTimer();
} catch (e) {
return useSetTimeout();
}
}
var scheduleFlush = void 0;
// Decide what async method to use to triggering processing of queued callbacks:
if (isNode) {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
} else if (browserWindow === undefined && typeof require === 'function') {
scheduleFlush = attemptVertx();
} else {
scheduleFlush = useSetTimeout();
}
function then(onFulfillment, onRejection) {
var parent = this;
var child = new this.constructor(noop);
if (child[PROMISE_ID] === undefined) {
makePromise(child);
}
var _state = parent._state;
if (_state) {
var callback = arguments[_state - 1];
asap(function () {
return invokeCallback(_state, child, callback, parent._result);
});
} else {
subscribe(parent, child, onFulfillment, onRejection);
}
return child;
}
/**
`Promise.resolve` returns a promise that will become resolved with the
passed `value`. It is shorthand for the following:
```javascript
let promise = new Promise(function(resolve, reject){
resolve(1);
});
promise.then(function(value){
// value === 1
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
let promise = Promise.resolve(1);
promise.then(function(value){
// value === 1
});
```
@method resolve
@static
@param {Any} value value that the returned promise will be resolved with
Useful for tooling.
@return {Promise} a promise that will become fulfilled with the given
`value`
*/
function resolve$1(object) {
/*jshint validthis:true */
var Constructor = this;
if (object && typeof object === 'object' && object.constructor === Constructor) {
return object;
}
var promise = new Constructor(noop);
resolve(promise, object);
return promise;
}
var PROMISE_ID = Math.random().toString(36).substring(2);
function noop() {}
var PENDING = void 0;
var FULFILLED = 1;
var REJECTED = 2;
function selfFulfillment() {
return new TypeError("You cannot resolve a promise with itself");
}
function cannotReturnOwn() {
return new TypeError('A promises callback cannot return that same promise.');
}
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
try {
then$$1.call(value, fulfillmentHandler, rejectionHandler);
} catch (e) {
return e;
}
}
function handleForeignThenable(promise, thenable, then$$1) {
asap(function (promise) {
var sealed = false;
var error = tryThen(then$$1, thenable, function (value) {
if (sealed) {
return;
}
sealed = true;
if (thenable !== value) {
resolve(promise, value);
} else {
fulfill(promise, value);
}
}, function (reason) {
if (sealed) {
return;
}
sealed = true;
reject(promise, reason);
}, 'Settle: ' + (promise._label || ' unknown promise'));
if (!sealed && error) {
sealed = true;
reject(promise, error);
}
}, promise);
}
function handleOwnThenable(promise, thenable) {
if (thenable._state === FULFILLED) {
fulfill(promise, thenable._result);
} else if (thenable._state === REJECTED) {
reject(promise, thenable._result);
} else {
subscribe(thenable, undefined, function (value) {
return resolve(promise, value);
}, function (reason) {
return reject(promise, reason);
});
}
}
function handleMaybeThenable(promise, maybeThenable, then$$1) {
if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
handleOwnThenable(promise, maybeThenable);
} else {
if (then$$1 === undefined) {
fulfill(promise, maybeThenable);
} else if (isFunction(then$$1)) {
handleForeignThenable(promise, maybeThenable, then$$1);
} else {
fulfill(promise, maybeThenable);
}
}
}
function resolve(promise, value) {
if (promise === value) {
reject(promise, selfFulfillment());
} else if (objectOrFunction(value)) {
var then$$1 = void 0;
try {
then$$1 = value.then;
} catch (error) {
reject(promise, error);
return;
}
handleMaybeThenable(promise, value, then$$1);
} else {
fulfill(promise, value);
}
}
function publishRejection(promise) {
if (promise._onerror) {
promise._onerror(promise._result);
}
publish(promise);
}
function fulfill(promise, value) {
if (promise._state !== PENDING) {
return;
}
promise._result = value;
promise._state = FULFILLED;
if (promise._subscribers.length !== 0) {
asap(publish, promise);
}
}
function reject(promise, reason) {
if (promise._state !== PENDING) {
return;
}
promise._state = REJECTED;
promise._result = reason;
asap(publishRejection, promise);
}
function subscribe(parent, child, onFulfillment, onRejection) {
var _subscribers = parent._subscribers;
var length = _subscribers.length;
parent._onerror = null;
_subscribers[length] = child;
_subscribers[length + FULFILLED] = onFulfillment;
_subscribers[length + REJECTED] = onRejection;
if (length === 0 && parent._state) {
asap(publish, parent);
}
}
function publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
if (subscribers.length === 0) {
return;
}
var child = void 0,
callback = void 0,
detail = promise._result;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
if (child) {
invokeCallback(settled, child, callback, detail);
} else {
callback(detail);
}
}
promise._subscribers.length = 0;
}
function invokeCallback(settled, promise, callback, detail) {
var hasCallback = isFunction(callback),
value = void 0,
error = void 0,
succeeded = true;
if (hasCallback) {
try {
value = callback(detail);
} catch (e) {
succeeded = false;
error = e;
}
if (promise === value) {
reject(promise, cannotReturnOwn());
return;
}
} else {
value = detail;
}
if (promise._state !== PENDING) {
// noop
} else if (hasCallback && succeeded) {
resolve(promise, value);
} else if (succeeded === false) {
reject(promise, error);
} else if (settled === FULFILLED) {
fulfill(promise, value);
} else if (settled === REJECTED) {
reject(promise, value);
}
}
function initializePromise(promise, resolver) {
try {
resolver(function resolvePromise(value) {
resolve(promise, value);
}, function rejectPromise(reason) {
reject(promise, reason);
});
} catch (e) {
reject(promise, e);
}
}
var id = 0;
function nextId() {
return id++;
}
function makePromise(promise) {
promise[PROMISE_ID] = id++;
promise._state = undefined;
promise._result = undefined;
promise._subscribers = [];
}
function validationError() {
return new Error('Array Methods must be provided an Array');
}
var Enumerator = function () {
function Enumerator(Constructor, input) {
this._instanceConstructor = Constructor;
this.promise = new Constructor(noop);
if (!this.promise[PROMISE_ID]) {
makePromise(this.promise);
}
if (isArray(input)) {
this.length = input.length;
this._remaining = input.length;
this._result = new Array(this.length);
if (this.length === 0) {
fulfill(this.promise, this._result);
} else {
this.length = this.length || 0;
this._enumerate(input);
if (this._remaining === 0) {
fulfill(this.promise, this._result);
}
}
} else {
reject(this.promise, validationError());
}
}
Enumerator.prototype._enumerate = function _enumerate(input) {
for (var i = 0; this._state === PENDING && i < input.length; i++) {
this._eachEntry(input[i], i);
}
};
Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
var c = this._instanceConstructor;
var resolve$$1 = c.resolve;
if (resolve$$1 === resolve$1) {
var _then = void 0;
var error = void 0;
var didError = false;
try {
_then = entry.then;
} catch (e) {
didError = true;
error = e;
}
if (_then === then && entry._state !== PENDING) {
this._settledAt(entry._state, i, entry._result);
} else if (typeof _then !== 'function') {
this._remaining--;
this._result[i] = entry;
} else if (c === Promise$1) {
var promise = new c(noop);
if (didError) {
reject(promise, error);
} else {
handleMaybeThenable(promise, entry, _then);
}
this._willSettleAt(promise, i);
} else {
this._willSettleAt(new c(function (resolve$$1) {
return resolve$$1(entry);
}), i);
}
} else {
this._willSettleAt(resolve$$1(entry), i);
}
};
Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
var promise = this.promise;
if (promise._state === PENDING) {
this._remaining--;
if (state === REJECTED) {
reject(promise, value);
} else {
this._result[i] = value;
}
}
if (this._remaining === 0) {
fulfill(promise, this._result);
}
};
Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
var enumerator = this;
subscribe(promise, undefined, function (value) {
return enumerator._settledAt(FULFILLED, i, value);
}, function (reason) {
return enumerator._settledAt(REJECTED, i, reason);
});
};
return Enumerator;
}();
/**
`Promise.all` accepts an array of promises, and returns a new promise which
is fulfilled with an array of fulfillment values for the passed promises, or
rejected with the reason of the first passed promise to be rejected. It casts all
elements of the passed iterable to promises as it runs this algorithm.
Example:
```javascript
let promise1 = resolve(1);
let promise2 = resolve(2);
let promise3 = resolve(3);
let promises = [ promise1, promise2, promise3 ];
Promise.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
If any of the `promises` given to `all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
Example:
```javascript
let promise1 = resolve(1);
let promise2 = reject(new Error("2"));
let promise3 = reject(new Error("3"));
let promises = [ promise1, promise2, promise3 ];
Promise.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
@method all
@static
@param {Array} entries array of promises
@param {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise} promise that is fulfilled when all `promises` have been
fulfilled, or rejected if any of them become rejected.
@static
*/
function all(entries) {
return new Enumerator(this, entries).promise;
}
/**
`Promise.race` returns a new promise which is settled in the same way as the
first passed promise to settle.
Example:
```javascript
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
let promise2 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 2');
}, 100);
});
Promise.race([promise1, promise2]).then(function(result){
// result === 'promise 2' because it was resolved before promise1
// was resolved.
});
```
`Promise.race` is deterministic in that only the state of the first
settled promise matters. For example, even if other promises given to the
`promises` array argument are resolved, but the first settled promise has
become rejected before the other promises became fulfilled, the returned
promise will become rejected:
```javascript
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
let promise2 = new Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error('promise 2'));
}, 100);
});
Promise.race([promise1, promise2]).then(function(result){
// Code here never runs
}, function(reason){
// reason.message === 'promise 2' because promise 2 became rejected before
// promise 1 became fulfilled
});
```
An example real-world use case is implementing timeouts:
```javascript
Promise.race([ajax('foo.json'), timeout(5000)])
```
@method race
@static
@param {Array} promises array of promises to observe
Useful for tooling.
@return {Promise} a promise which settles in the same way as the first passed
promise to settle.
*/
function race(entries) {
/*jshint validthis:true */
var Constructor = this;
if (!isArray(entries)) {
return new Constructor(function (_, reject) {
return reject(new TypeError('You must pass an array to race.'));
});
} else {
return new Constructor(function (resolve, reject) {
var length = entries.length;
for (var i = 0; i < length; i++) {
Constructor.resolve(entries[i]).then(resolve, reject);
}
});
}
}
/**
`Promise.reject` returns a promise rejected with the passed `reason`.
It is shorthand for the following:
```javascript
let promise = new Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
let promise = Promise.reject(new Error('WHOOPS'));
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
@method reject
@static
@param {Any} reason value that the returned promise will be rejected with.
Useful for tooling.
@return {Promise} a promise rejected with the given `reason`.
*/
function reject$1(reason) {
/*jshint validthis:true */
var Constructor = this;
var promise = new Constructor(noop);
reject(promise, reason);
return promise;
}
function needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
function needsNew() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
/**
Promise objects represent the eventual result of an asynchronous operation. The
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise's eventual value or the reason
why the promise cannot be fulfilled.
Terminology
-----------
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
A promise can be in one of three states: pending, fulfilled, or rejected.
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
Basic Usage:
------------
```js
let promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
// on failure
reject(reason);
});
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Advanced Usage:
---------------
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
let xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
}
}
};
});
}
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
Unlike callbacks, promises are great composable primitives.
```js
Promise.all([
getJSON('/posts'),
getJSON('/comments')
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
return values;
});
```
@class Promise
@param {Function} resolver
Useful for tooling.
@constructor
*/
var Promise$1 = function () {
function Promise(resolver) {
this[PROMISE_ID] = nextId();
this._result = this._state = undefined;
this._subscribers = [];
if (noop !== resolver) {
typeof resolver !== 'function' && needsResolver();
this instanceof Promise ? initializePromise(this, resolver) : needsNew();
}
}
/**
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
```js
findUser().then(function(user){
// user is available
}, function(reason){
// user is unavailable, and you are given the reason why
});
```
Chaining
--------
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
```js
findUser().then(function (user) {
return user.name;
}, function (reason) {
return 'default name';
}).then(function (userName) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
throw new Error('`findUser` rejected and we're unhappy');
}).then(function (value) {
// never reached
}, function (reason) {
// if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
// If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
}).then(function (value) {
// never reached
}).then(function (value) {
// never reached
}, function (reason) {
// The `PedgagocialException` is propagated all the way down to here
});
```
Assimilation
------------
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// The user's comments are now available
});
```
If the assimliated promise rejects, then the downstream promise will also reject.
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
}).then(function (comments) {
// If `findCommentsByAuthor` fulfills, we'll have the value here
}, function (reason) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
Simple Example
--------------
Synchronous Example
```javascript
let result;
try {
result = findResult();
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
findResult(function(result, err){
if (err) {
// failure
} else {
// success
}
});
```
Promise Example;
```javascript
findResult().then(function(result){
// success
}, function(reason){
// failure
});
```
Advanced Example
--------------
Synchronous Example
```javascript
let author, books;
try {
author = findAuthor();
books = findBooksByAuthor(author);
// success
} catch(reason) {
// failure
}
```
Errback Example
```js
function foundBooks(books) {
}
function failure(reason) {
}
findAuthor(function(author, err){
if (err) {
failure(err);
// failure
} else {
try {
findBoooksByAuthor(author, function(books, err) {
if (err) {
failure(err);
} else {
try {
foundBooks(books);
} catch(reason) {
failure(reason);
}
}
});
} catch(error) {
failure(err);
}
// success
}
});
```
Promise Example;
```javascript
findAuthor().
then(findBooksByAuthor).
then(function(books){
// found books
}).catch(function(reason){
// something went wrong
});
```
@method then
@param {Function} onFulfilled
@param {Function} onRejected
Useful for tooling.
@return {Promise}
*/
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
```js
function findAuthor(){
throw new Error('couldn't find that author');
}
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
@method catch
@param {Function} onRejection
Useful for tooling.
@return {Promise}
*/
Promise.prototype.catch = function _catch(onRejection) {
return this.then(null, onRejection);
};
/**
`finally` will be invoked regardless of the promise's fate just as native
try/catch/finally behaves
Synchronous example:
```js
findAuthor() {
if (Math.random() > 0.5) {
throw new Error();
}
return new Author();
}
try {
return findAuthor(); // succeed or fail
} catch(error) {
return findOtherAuther();
} finally {
// always runs
// doesn't affect the return value
}
```
Asynchronous example:
```js
findAuthor().catch(function(reason){
return findOtherAuther();
}).finally(function(){
// author was either found, or not
});
```
@method finally
@param {Function} callback
@return {Promise}
*/
Promise.prototype.finally = function _finally(callback) {
var promise = this;
var constructor = promise.constructor;
if (isFunction(callback)) {
return promise.then(function (value) {
return constructor.resolve(callback()).then(function () {
return value;
});
}, function (reason) {
return constructor.resolve(callback()).then(function () {
throw reason;
});
});
}
return promise.then(callback, callback);
};
return Promise;
}();
Promise$1.prototype.then = then;
Promise$1.all = all;
Promise$1.race = race;
Promise$1.resolve = resolve$1;
Promise$1.reject = reject$1;
Promise$1._setScheduler = setScheduler;
Promise$1._setAsap = setAsap;
Promise$1._asap = asap;
/*global self*/
function polyfill() {
var local = void 0;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof self !== 'undefined') {
local = self;
} else {
try {
local = Function('return this')();
} catch (e) {
throw new Error('polyfill failed because global object is unavailable in this environment');
}
}
var P = local.Promise;
if (P) {
var promiseToString = null;
try {
promiseToString = Object.prototype.toString.call(P.resolve());
} catch (e) {
// silently ignored
}
if (promiseToString === '[object Promise]' && !P.cast) {
return;
}
}
local.Promise = Promise$1;
}
// Strange compat..
Promise$1.polyfill = polyfill;
Promise$1.Promise = Promise$1;
return Promise$1;
})));
//# sourceMappingURL=es6-promise.map
/*!
* jQuery JavaScript Library v3.5.1
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2020-05-04T22:49Z
*/
( function( global, factory ) {
"use strict";
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";
var arr = [];
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var flat = arr.flat ? function( array ) {
return arr.flat.call( array );
} : function( array ) {
return arr.concat.apply( [], array );
};
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call( Object );
var support = {};
var isFunction = function isFunction( obj ) {
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML